import { nullDisplay } from '../utils'

// 价格组件设置
export default {
  props: {
    value: [String, Number],
    options: Object
  },
  render(h) {
    var value = parseFloat(this.value)
    if (isNaN(value)) {
      return nullDisplay(h, this.options)
    } else {
      value = (value * 100).toFixed(2)
    }
    return h(
      'div',
      {
        attrs: this.options
      },
      Number(value) + '%'
    )
  }
}
